echo off

set root=%~dp0

set msbuild3=%windir%\Microsoft.NET\Framework\v3.5\MSBuild.exe
set msbuild2=%windir%\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
set msbuild=%msbuild3%
if not exist %msbuild% set msbuild=%msbuild2%
if not exist %msbuild% (
	echo msbuild tool not found on this system
	pause
	goto exit
)

rem clear project temp files
for /r "%root%\src" %%a in (*.vcproj) do (
	if exist "%%~dpa\debug" rd /s /q "%%~dpa\debug"
)
if exist "%root%\src\Debug" rd /s /q "%root%\src\Debug"

"%msbuild%" "%root%\src\librarian.sln"
if ERRORLEVEL 1 pause

:exit